/*
 * thread.h
 *
 *  Created on: 10.01.2013
 *      Author: phru
 */

#ifndef THREAD_H_
#define THREAD_H_

#include <msp430.h>
#include <inttypes.h>
#include <stdlib.h>
#include <setjmp.h>

/**
 * Starts the thread
 */
void runThread1(void);

void runThread2(void);

typedef enum {
	THREAD_RUNNING,
	THREAD_READY
}state_t;

typedef struct{
	uint16_t id;
	state_t state;
	jmp_buf context;
	void (*run)();
} thread_t;

/**
 * Creat thread 1
 */
thread_t* createThread1(uint16_t id);

/**
 * Create thread 2
 */
thread_t* createThread2(uint16_t id);

#endif /* THREAD_H_ */
